package net.huashitong.ssydt.provider.exam.service;


import net.huashitong.ssydt.exam.entity.SsExamPaperTypeHot;
import net.huashitong.ssydt.provider.exam.mapper.SsExamPaperTypeHotMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.09.13
 */
@Service
@Transactional
public class SsExamPaperTypeHotServiceImpl implements SsExamPaperTypeHotService {

    private SsExamPaperTypeHotMapper mapper;

    @Autowired
    public SsExamPaperTypeHotServiceImpl(SsExamPaperTypeHotMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SsExamPaperTypeHot record) {
        return mapper.insert(record);
    }

    @Override
    public int insertSelective(SsExamPaperTypeHot record) {
        return mapper.insertSelective(record);
    }

    @Override
    public SsExamPaperTypeHot selectByPrimaryKey(Long id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(SsExamPaperTypeHot record) {
        return mapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SsExamPaperTypeHot record) {
        return mapper.updateByPrimaryKey(record);
    }

    @Override
    public List<SsExamPaperTypeHot> findOrderHotNumberDesc() {
        return mapper.findOrderHotNumberDesc();
    }

    @Override
    public SsExamPaperTypeHot getByTypeValue(String typeValue) {
        return mapper.getByTypeValue(typeValue);
    }

    @Override
    public void incrementHotNumber(Long id, long addHotNumber) {
        SsExamPaperTypeHot ssExamPaperTypeHot = new SsExamPaperTypeHot();
        ssExamPaperTypeHot.setHotNumber(addHotNumber);
        ssExamPaperTypeHot.setId(id);
        mapper.incrementHotNumber(ssExamPaperTypeHot);
    }
}
